<!--tvm票款差异协查-->
<template>
  <div class="fenQianXiangCengjiCYDXC HuikuiInfo el-card is-always-shadow el-card__body">
    <el-dialog
      title="操作回馈信息"
      :visible.sync="dialogVisible"
      @close="closed"
      width="950px">
      <div style="line-height: 40px;background-color: #fcf7f7;padding-left: 15px">
        <span>线路：</span><span>{{getLineName(formData.lineCode)}}</span>
        <span style="margin-left: 20px">站点：</span><span>{{getStationName(formData.lineCode,formData.stationCode)}}</span>
        <span style="margin-left: 20px">TVM编号：</span><span>{{formData.tvmOrder}}</span>
        <span style="margin-left: 20px">钱箱类型：</span><span>{{getQianxiangType(formData.tvmMoneyType)}}</span>
        <span style="margin-left: 20px">钱箱编号：</span><span>{{formData.tvmMoneyOrder}}</span>
      </div>
      <avue-form v-if="isReload" class="fenQianXiangCengjiCYDXCForm" :option="option" v-model="formData" @submit="handleSubmit">
        <template slot-scope="{row}" slot="type">
          <span>{{row.type}}</span>
        </template>
        <template slot-scope="{row}" slot="saleAmount">
          <span>{{fenExYuangettoFixed(row,'saleAmount')}}</span>
        </template>
        <template slot-scope="{row}" slot="saleAmountCY">
          <span>{{fenExYuangettoFixed(row,'saleAmountCY')}}</span>
        </template>
        <template slot-scope="{row}" slot="replySystemAmount">
          <el-input-number style="width:200px" v-model="formData.replySystemAmount" controls-position="right" :precision="2" :disabled="showType==2"></el-input-number>
        </template>

        <template slot-scope="scope" slot="menuForm">
          <el-button type="primary" @click="handleSubmit" v-if="showType==1">确认</el-button>
          <el-button  @click="closed" >返回</el-button>
        </template>
      </avue-form>
    </el-dialog>
  </div>
</template>


<script>
  import {
    clearSelect, electromeReasons, qianxiangType, fenExYuangettoFixed,
    getQianxiangType, getLineName, getStationName, allStatus
  } from "../../../../../../../../api/subwayRat/commonCheck";
  import {
    FQXCJCY_cols1,
    getFQXCJCYMondifyData1, submitSwAuTvmCashboxAmountHierarchyDifference
  } from "../../../../../../../../api/stationTiecketManager/shuJuXieChaGuanLi/TVM/XT/CJCY/FQXCJCY/FQXCJCY";

  export default {
    components:{
    },
    data() {
      return {
        isReload:true,
        th:null,
        //1编辑，2预览
        showType:1,
        replaceStatus:0,
        dialogVisible:true,
        formData:{
        },
        option:{

        }
    }
    },
    created() {
    },
    methods: {
      getQianxiangType,getLineName,getStationName,
      fenExYuangettoFixed,
      handleSubmit(){
        let param={};
        Object.assign(param,this.formData);
        this.formatAmount(param,false);
        submitSwAuTvmCashboxAmountHierarchyDifference(param).then(res=>{
          if(res.data.code==0){
            this.$message.success("操作成功！");
            this.$parent.getList();
            this.closed();
          }else{
            this.$message.error(res.data.msg);
          }
        })
      },
      recallShow(id,row,showType,replaceStatus,th){
        this.replaceStatus = replaceStatus;
        this.th = th;
        this.showType=showType;
        this.getOption();
        this.formData={};
        Object.assign(this.formData,row);
        this.formatAmount(this.formData,true);
        let mondify1=getFQXCJCYMondifyData1(row);
        // let mondify2=getMondifyData2(row);
        this.formData.dynamic=mondify1;
      },
      formatAmount(row,isYuan){
        if(isYuan){
          row.replySystemAmount=fenExYuangettoFixed(row,'replySystemAmount');
        }else{
          row.replySystemAmount=Number(row.replySystemAmount)*100;
        }
      },
      closed(){
        this.th.isShowDia=false;
      },
      getOption(){
        let group1={
          icon:'',
          sortable:true,
          label: '层级差异信息',
          // collapse:false,
          prop: 'group1',
          indexLabel:"#",
          column: [{
            label: '',
            prop: 'dynamic',
            type: 'dynamic',
            span:24,
            children: {
              addBtn:false,
              delBtn:false,
              sortable:true,
              index:false,
              indexLabel:"#",
              align: 'center',
              headerAlign: 'center',
              column: FQXCJCY_cols1
            }
          }
          ]
        };
        let group2={
          icon:'',
          sortable:true,
          label: '层级差异协查与回馈',
          // collapse:false,
          prop: 'group2',
          indexLabel:"#",
          labelWidth:140,
          column: [{
            label: '回馈系统清点金额',
            prop: 'replySystemAmount',
            type: 'number',
            precision:2,
            formslot:true,
            labelWidth:140,
            span:3,
          }
          ]
        };

        let group3={
          icon:'',
          label: '',
          // collapse:false,
          prop: 'group3',
          column: [{
            label: '差异原因',
            prop: 'jdReplyReason',
            labelWidth:200,
            disabled: this.showType==2,
            type:'select',
            dicData:allStatus['JD_REPLY_REASON'],
          },
            {
              label: '机电专业详细描述',
              prop: 'jdReplyDetail',
              type: 'textarea',
              labelWidth:150,
              disabled: this.showType==2
            }
          ]
        };

        this.option={
          submitBtn:false,
          emptyBtn:false,
          span:12,
          group:[]
        } ;
        this.option.group.push(group1);
        this.option.group.push(group2);
        this.option.group.push(group3);
        this.isReload=false;
        this.$nextTick(()=>{
          this.isReload=true;
        })
      }
    },
    mounted() {

    }
  }
</script>
<style lang="scss">
  .fenQianXiangCengjiCYDXC{
    .fenQianXiangCengjiCYDXCForm{

      .avue-group[index='1']{
        .el-form-item{
          min-width: 450px;
        }
        .avue-form__row{
          width: 100%;
        }
      }
      .avue-group[index='2']{
        .el-form-item{
          min-width: 450px;
        }
        .avue-form__row{
          width: 100%;
        }
      }
    }
  }

</style>
